package com.yyr.callmessage.core.config;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;

@Configuration
public class LocaleConfig {
    private static MessageSource _messageInstance;

    @Bean
    MessageSource messageSource() {
        ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
        resourceBundleMessageSource.setBasename("messages");
        resourceBundleMessageSource.setDefaultEncoding("UTF-8");
        _messageInstance = resourceBundleMessageSource;
        return resourceBundleMessageSource;
    }

    public static MessageSource getMessageInstance() {
        return _messageInstance;
    }
}
